package com.api.mc
{
	import com.game.btnClass.AddMouseEvent;
	import com.game.btnClass.BtnClass_goto;
	import com.game.btnClass.BtnClass_scale;
	import com.game.display.AutoGCMovieClip;
	import com.game.utils.MyTimer;
	
	import flash.display.MovieClip;
	import flash.text.TextField;
	
	public class UserLeave extends AutoGCMovieClip
	{
		
		
		public var timeTxt:TextField;
		
		private var _time:int=3;
		private var _myTimer:MyTimer;
		
		private var _restartFun:Function;
		
		public function UserLeave(fun:Function)
		{
			_restartFun=fun;
			_myTimer=new MyTimer();
			init();
		}
		private function init():void{
			runTime();
			_myTimer.setTimer(runTime,1*1000);
		}
		private function runTime():void{
			timeTxt.text="倒计时: "+_time+" 秒";
			_time--;
			if(_time==-1){
				_myTimer.gc();
				_restartFun();
				
			}
		}
		public function gc():void{
			_myTimer.gc();
			_myTimer=null;
			_restartFun=null;
		}
	}
}